<template>
  <div class="app-container">

    <div class="operator-container">
      <div>
          实名类型：
          <el-select v-model="realType" placeholder="请选择GN或玩家">
            <el-option
              v-for="item in realTypeList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
          实名状态：
          <el-select v-model="ulock" placeholder="请选择实名状态">
            <el-option
              v-for="item in ulockList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
          <el-button type="primary" size="mini" :loading="listLoading" @click="showContent">查询</el-button>
      </div>
      <div>
        <el-button v-permission="['GET /admin/realprove/batchexamine']" class="filter-item" type="primary"  @click="batchPass">批量审核</el-button>
        <el-button v-permission="['GET /admin/realprove/batchnoexamine']" class="filter-item" type="danger"  @click="batchReject">批量驳回</el-button>
      </div>
    </div>

    <!-- 查询结果 -->
    <el-table v-loading="listLoading" :data="list" element-loading-text="正在查询中。。。" border fit highlight-current-row @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" />

      <el-table-column align="center" label="id" prop="id" />



      <el-table-column align="center" label="添加时间" prop="updateTime" />

      <el-table-column align="center" label="管理员ID" prop="adminId" />
      <el-table-column align="center" label="姓名" prop="userName" />
      <el-table-column align="center" label="身份证" prop="userCardNum" />
      <el-table-column align="center" label="年龄" prop="birthday" />
      <el-table-column align="center" label="身份证照" >
        <template slot-scope="scope">
            <img :src="scope.row.cardImg" style="width:80px; height: 40px;" />
        </template>
      </el-table-column>
      <el-table-column align="center" label="身份证照">
        <template slot-scope="scope">
            <img :src="scope.row.cardBackImg" style="width:80px; height: 40px;" />
        </template>
      </el-table-column>
      <el-table-column align="center" label="公司名称" prop="companyName" />
      <el-table-column align="center" label="营业执照号" prop="companyCode" />
      <el-table-column align="center" label="营业执照图片">
        <template slot-scope="scope">
            <img :src="scope.row.companyUrl" style="width:80px; height: 40px;" />
        </template>
      </el-table-column>
      
      <el-table-column align="center" label="卡号" prop="bankAccount" />
      <el-table-column align="center" label="开户行">
        <template slot-scope="scope">
          {{scope.row.bankProvince+scope.row.bankCity+scope.row.bankSubname}}
        </template>
      </el-table-column>

      <el-table-column align="center" label="操作" min-width="130" v-if="ulock==0 || ulock==3" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button v-permission="['POST /admin/realprove/examine']" type="primary" size="mini" @click="Pass(scope.row)">审核通过</el-button>
          <el-button v-permission="['POST /admin/realprove/noexamine']" type="danger" size="mini" @click="Reject(scope.row)">驳回审核</el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> -->




  </div>
</template>

<script>
import { list,examine,noexamine,batchexamine,deleteNotice} from '@/api/realName'
import storage from '@/api/storage'
import { getToken } from '@/utils/auth'

export default {
  name: 'GMaudit',

  data() {
    return {
      realType:1,
      realTypeList:[{id:1,name:'GM实名认证'},{id:2,name:'玩家实名认证'}],
      ulock:0,
      ulockList:[{id:0,name:'新创建'},{id:1,name:'已审核'},{id:2,name:'已驳回'},{id:3,name:'审核中'}],
      list: [],
      total: 0,
      listLoading: false,
      listQuery: {
        page: 1,
        limit: 20,
        title: undefined,
        content: undefined,
        sort: 'add_time',
        order: 'desc'
      },
  

    }
  },
  computed: {
    headers() {
      return {
        'X-Hyxxkj-Admin-Token': getToken()
      }
    }
  },
  created() {
    
  },
  mounted(){
    this.getList()
  },
  methods: {
    handleSelectionChange(e){//选中
        console.log(e)
    },
    getList() {
      this.listLoading=true
      list({
        limit:this.listQuery.limit,
        page:this.listQuery.page,
        ulock:this.ulock,
        ralType:this.realType
      }).then(res=>{
        this.listLoading=false
        this.list=res.data.data.list
      }).catch(res=>{
        this.listLoading=false
      })
    },
    showContent(){//查询
        this.getList()
    },
    Pass(e){//通过
      examine({
        id:e.id
      }).then(res=>{
          console.log(res.data)
          if(res.data.errno==0){
              this.getList()
              this.$message.success("审核成功")
          }
          else{
            this.$message.error("审核失败");
          }
      }).catch(err=>{

      })
    },
    Reject(e){//驳回
      noexamine({
        id:e.id
      }).then(res=>{
          if(res.data.errno==0){
              this.$message.success("驳回成功")
              this.getList()
          }
          else{
            this.$message.error("驳回失败");
          }
      }).catch(err=>{
        
      })
    },
    batchPass(){//批量通过
      batchexamine().then(res=>{

      }).catch(err=>{
        
      })
    },
    batchReject(){//批量驳回
      batchnoexamine().then(res=>{

      }).catch(err=>{
        
      })
    }
 

  }
}
</script>
<style scoped>
.operator-container{
  justify-content: space-between;
}
</style>
